# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Language.V1.Model.XPSConfusionMatrix do
  @moduledoc """
  Confusion matrix of the model running the classification.

  ## Attributes

  *   `annotationSpecIdToken` (*type:* `list(String.t)`, *default:* `nil`) - For the following three repeated fields, only one is intended to be set. annotation_spec_id_token is preferable to be set. ID tokens of the annotation specs used in the confusion matrix.
  *   `category` (*type:* `list(integer())`, *default:* `nil`) - Category (mainly for segmentation). Set only for image segmentation models. Note: uCAIP Image Segmentation should use annotation_spec_id_token.
  *   `row` (*type:* `list(GoogleApi.Language.V1.Model.XPSConfusionMatrixRow.t)`, *default:* `nil`) - Rows in the confusion matrix. The number of rows is equal to the size of `annotation_spec_id_token`. `row[i].value[j]` is the number of examples that have ground truth of the `annotation_spec_id_token[i]` and are predicted as `annotation_spec_id_token[j]` by the model being evaluated.
  *   `sentimentLabel` (*type:* `list(integer())`, *default:* `nil`) - Sentiment labels used in the confusion matrix. Set only for text sentiment models. For AutoML Text Revamp, use `annotation_spec_id_token` instead and leave this field empty.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotationSpecIdToken => list(String.t()) | nil,
          :category => list(integer()) | nil,
          :row => list(GoogleApi.Language.V1.Model.XPSConfusionMatrixRow.t()) | nil,
          :sentimentLabel => list(integer()) | nil
        }

  field(:annotationSpecIdToken, type: :list)
  field(:category, type: :list)
  field(:row, as: GoogleApi.Language.V1.Model.XPSConfusionMatrixRow, type: :list)
  field(:sentimentLabel, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.XPSConfusionMatrix do
  def decode(value, options) do
    GoogleApi.Language.V1.Model.XPSConfusionMatrix.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Language.V1.Model.XPSConfusionMatrix do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
